package com.zhang.service.impl;

import com.zhang.entity.UserSalt;
import com.zhang.repository.UserSaltRepository;
import com.zhang.service.UserSaltService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 21级 计科院·张艺澄
 * 2024.12.8
 */
@Service("userSaltService")
public class UserSaltServiceImpl implements UserSaltService {

    @Resource
    private UserSaltRepository userSaltRepository;

    @Override
    public void save(UserSalt userSalt) {
         userSaltRepository.save(userSalt);
    }

    @Override
    public void delete(UserSalt userSalt) {
        userSaltRepository.delete(userSalt);
    }

    @Override
    public UserSalt findById(Integer id) {
        return userSaltRepository.findById(id).get();
    }

    @Override
    public void deleteByUserId(Integer userId) {
        userSaltRepository.deleteByUserId(userId);
    }

    @Override
    public void deleteBySaltId(Integer userId) {
        userSaltRepository.deleteBySaltId(userId);
    }
}
